{% extends 'news/base.html' %}

{% block style %}
    {% load static %}
    <link rel="stylesheet" href="{% static 'news/css/log.css' %}">
{% endblock %}

{% block t_r %}
    <div id="user_down">
        <a href="" ><span class="user_down_s1">登录</span></a>
        <span></span>
        <a href='{% url "news:register" %}'><span class="user_down_s2">注册</span></a>
    </div>
{% endblock %}


{% block top %}
    <div id="up">
        <div></div>Cnnews欢迎您-登陆
        <span>
            <span>还没有账号?</span>
            <a href="{% url 'news:register' %}">立即注册</a>
        </span>
    </div>
{% endblock %}


{% block content %}

    <form action="{% url 'news:base' %}" method="post" id="form">
    {% csrf_token %}
    <div id="down">
        <div>
            <input type="text" name="username" placeholder="请输入手机号" id="phone" >
             <span>{{ msg }}</span>
        </div>
        <div>
            <input type="password" name="password" placeholder="请输入密码" id="password">
            <span>{{ msg }}</span>
        </div>
        <div>
            <span class="s1">
                <input type="checkbox" checked="checked" name="remember">
                记住密码
            </span>
            <a href="{% url 'news:forget' %}"><span id="s2">忘记密码?</span></a>

        </div>
        <input type="submit" class="a3" value="登录" >

    </div>
    </form>

{% endblock %}
{% block js %}
    <script src="{% static 'js/log.js' %}"></script>
    <script>
        $('form').submit(function (e) {
            if (!$('#phone').val()) {
                alert("用户名不能为空");
                $('#phone').focus();
                return false;
            }

            if (!$('#password').val()) {
                alert("密码不能为空");
                $('#password').focus();
                return false;
            }

        });



    </script>
{% endblock %}


